<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui">

	<h:head><h1>Ricerca / Visualizza Elementi</h1>
	
	<link type="text/css" href="../generalstyle.css" rel="stylesheet"/>
	
	 <style type="text/css">
        .ui-layout-unit{
             border: none;
        }
    </style>
    </h:head>
<body>
	<img src="http://us.cdn4.123rf.com/168nwm/aberheide/aberheide1103/aberheide110300035/9178998-cartello-giallo-con-un-punto-interrogativo.jpg" alt="" />
	  <h:form>
        <p:menubar>  
                <p:menuitem value="Home" url="../home.xhtml" />  
				<p:menuitem value="Area Cliente" url="../cliente/homeCliente.xhtml" />
				<p:menuitem value="Area Impiegato" url="../impiegato/homeImpiegato.xhtml" /> 
				<p:menuitem value="Login" url="../login.xhtml" rendered="#{request.remoteUser == null}" />
                <p:menuitem value="Logout" actionListener="#{logoutManagedBean.logout()}" rendered="#{request.remoteUser != null}" />
		</p:menubar>
		</h:form>
    <br></br>
    <h:form>
		<p:inputText  id="cerca" value="#{ElementoManagedBean.cerca}" />
		<p></p>
		<p:commandButton value="CERCA HOTEL" actionListener="#{ElementoManagedBean.cercaHotel()}" ajax="false" />
		<p:commandButton value="VISUALIZZA HOTEL" actionListener="#{ElementoManagedBean.visualizzaHotel()}" ajax="false" />
		&nbsp;		
		<p:commandButton value="CERCA VOLI" actionListener="#{ElementoManagedBean.cercaVoli()}" ajax="false" />
		<p:commandButton value="VISUALIZZA VOLI" actionListener="#{ElementoManagedBean.visualizzaVoli()}" ajax="false" />
				&nbsp;		
		
		<p:commandButton value="CERCA ESCURSIONI" actionListener="#{ElementoManagedBean.cercaEscursioni()}" ajax="false" />
		<p:commandButton value="VISUALIZZA ESCURSIONI" actionListener="#{ElementoManagedBean.visualizzaEscursioni()}" ajax="false" />
	</h:form>
    
    <hr></hr>
    <ui:repeat value="#{ElementoManagedBean.hotels}" var="hotelCorr" varStatus="statoHotel">
        <h:form>
          <p:layout style=" height:200px;">
				<p:layoutUnit position="center">
				
					<p:layout style="height:50px;" >
						<p:layoutUnit position="west" size="200">
							<p:outputLabel value="Nome Hotel: " />
							<p></p>
							<p:outputLabel value="Indirizzo Hotel: " />
							<p></p>
							<p:outputLabel value="Prezzo: " />
							<p></p>
							<p:outputLabel value="Data: " />
							
						</p:layoutUnit>
						
						<p:layoutUnit position="center">
							 <p:outputLabel id="hNome" value="#{hotelCorr.nome}"/>
							 <p></p>
          					<p:outputLabel id="hIndirizzo" value="#{hotelCorr.indirizzo}" />
          					<p></p>
							<p:outputLabel id="hPrezzo" value="#{hotelCorr.prezzo}" />
							<p></p>
							<p:outputLabel id="hData" value="#{hotelCorr.data}" />
							
						</p:layoutUnit>
					</p:layout>
					
				</p:layoutUnit>
				<p:layoutUnit position="east" size="600">
					<p:commandButton actionListener="#{ElementoManagedBean.rimuoviHotel(ElementoManagedBean.hotels.get(statoHotel.index).id)}" value="RIMUOVI" ajax="false" />
					<p:commandButton actionListener="#{ElementoManagedBean.modificaHotelCorrente(ElementoManagedBean.hotels.get(statoHotel.index))}" value="MODIFICA" ajax="false" />
					
				</p:layoutUnit>
			</p:layout>
        </h:form>            
    </ui:repeat>
    
<hr></hr>
  


    <ui:repeat value="#{ElementoManagedBean.voli}" var="voloCorr" varStatus="statoVolo">
        <h:form>
         <p:layout style=" height:200px;">
				<p:layoutUnit position="center">
				
					<p:layout style="height:50px;" >
						<p:layoutUnit position="west" size="200">
							<p:outputLabel value="Volo Partenza: " />
							<p></p>
							<p:outputLabel value="Volo Destinazione: " />
						    <p></p>
							<p:outputLabel value="Prezzo: " />
							<p></p>
							<p:outputLabel value="Data: " />	
						</p:layoutUnit>
						
						<p:layoutUnit position="center">
							<p:outputLabel id="luogoPart" value="#{voloCorr.luogoPartenza}" />
							<p></p>
           					 <p:outputLabel id="luogoDest" value="#{voloCorr.luogoDestinazione}" />
           					 <p></p>
							<p:outputLabel id="vPrezzo" value="#{voloCorr.prezzo}" />
							<p></p>
							<p:outputLabel id="vData" value="#{voloCorr.data}" />
						</p:layoutUnit>
					</p:layout>
					
				</p:layoutUnit>
				<p:layoutUnit position="east" size="600">
						<p:commandButton
						actionListener="#{ElementoManagedBean.rimuoviVolo(ElementoManagedBean.voli.get(statoVolo.index).id)}"
						value="RIMUOVI" ajax="false" />
								<p:commandButton
						actionListener="#{ElementoManagedBean.modificaVoloCorrente(ElementoManagedBean.voli.get(statoVolo.index))}"
						value="MODIFICA" ajax="false" />
				</p:layoutUnit>
			</p:layout>
        </h:form>
    </ui:repeat>
    
<hr></hr>
    <ui:repeat value="#{ElementoManagedBean.escursioni}" var="escCorr" varStatus="statoEsc">
        <h:form>
        <p:layout style=" height:200px;">
				<p:layoutUnit position="center">
				
					<p:layout style="height:50px;" >
						<p:layoutUnit position="west" size="200">
							<p:outputLabel value="Indirizzo Escursione: " />
							<p></p>
							<p:outputLabel value="Posti Escursione: " />
							<p></p>
							<p:outputLabel value="Prezzo: " />
							<p></p>
							<p:outputLabel value="Data: " />
							
						</p:layoutUnit>
						
						<p:layoutUnit position="center">
						  <p:outputLabel  id="indirizzo" value="#{escCorr.indirizzo}" />
							<p></p>
					      <p:outputLabel id="numeroPosti" value="#{escCorr.numeroPosti}" />
					       <p></p>
						  	<p:outputLabel id="ePrezzo" value="#{escCorr.prezzo}" />
						  <p></p>
							<p:outputLabel id="eData" value="#{escCorr.data}" />
						</p:layoutUnit>
					</p:layout>
					
				</p:layoutUnit>
				<p:layoutUnit position="east" size="600">
						<p:commandButton
						actionListener="#{ElementoManagedBean.rimuoviEscursione(ElementoManagedBean.escursioni.get(statoEsc.index).id)}"
						value="RIMUOVI" ajax="false" />
						<p:commandButton
						actionListener="#{ElementoManagedBean.modificaEscursioneCorrente(ElementoManagedBean.escursioni.get(statoEsc.index))}"
						value="MODIFICA" ajax="false" />
				</p:layoutUnit>
			</p:layout>
        </h:form>
    </ui:repeat>
    

      
</body>
</html>